package cn.gyx.hrm.feign.client;

import cn.gyx.hrm.domain.Login;
import cn.gyx.hrm.dto.LoginAndMealDto;
import cn.gyx.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


// 降级类
@Component
@Slf4j
public class LoginFeignClientFallBack implements FallbackFactory<LoginFeignClient> {
    @Override
    public LoginFeignClient create(Throwable throwable) {
        return new LoginFeignClient() {

//            @Override
//            public AjaxResult save(Login login) {
//                log.error("登陆异常:{}",throwable.getMessage());
//                throwable.printStackTrace();
//                return AjaxResult.me().setSuccess(false).setMessage("保存至认证中心异常");
//            }

            @Override
            public AjaxResult saveLoginAndMealId(LoginAndMealDto loginAndMealDto) {
                log.error("登陆异常:{}",throwable.getMessage());
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("保存至认证中心异常");
            }
        };
    }
}
